const router=require("koa-router")()
// const query=require("../db/query")
router.post("/api/search", async ctx => {//模糊搜索
    let { key } = ctx.request.body
    console.log(key);
    
    try {
       let data= await ctx.mysql.query(`select * from userList where type like '%${key}%'`)
       console.log(data);
        ctx.body={
            code:1,
            msg:data
        }
    } catch(e){
        ctx.body={
            code:0,
            msg:"查找不存在"
        }
    }
})


module.exports=router